home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 151-175 / scopedisk158 / mat / ren < prev    next >
Text File  |  1995-03-19  |  962b  |  26 lines

  1. .k file/A,as/A
  2. .bra {
  3. .ket }
  4. ;;    REN       --  Extended renaming of multiple
  5. ;;                  files.
  6. ;; (Note that Directories are deliberately excluded (FILES mode, not DIRS)
  7. ;; to avoid the possibility of eating oneself...; multiple directory
  8. ;; renames aren't often needed anyway, but you can change it if you want.)
  9.  
  10. mat key "#?'^#?" "{as}" ;; if there are no markers in the template
  11.                         ;; just use standard rename:
  12. if warn
  13.   rename "{file}" as "{as}"
  14. else
  15.   run mat >t:_ren f "cd ^Q^D^Q^Brename ^Q^F^Q as ^Q{as}^Q" "{file}" +
  16.     execute t:_ren +
  17.     delete t:_ren
  18. endif
  19.  
  20. ;; this script itself creates a subsidiary script ("T:_ren") to do the
  21. ;; renaming work; this will contain two lines for each matching file
  22. ;; to be renamed: the first is a CD to the directory, the second is the
  23. ;; constructed rename command for that file.
  24. ;;; NOTE that a PIPE: would NOT be a safe way to do it!
  25. ;;; (you might end up (re)cursing violently!)
  26.